package jym.tan.movielibrary.component.listener;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import jym.tan.movielibrary.component.ui.combobox.ThemeComboBox;
import jym.tan.movielibrary.configuration.ConfigurationManager;
import jym.tan.movielibrary.logger.LibraryLogger;
import jym.tan.movielibrary.model.ThemeModel;

public class ThemeComboBoxListener implements ActionListener {

	public void actionPerformed(ActionEvent actionEvent) {
		ThemeComboBox themeComboBox = (ThemeComboBox) actionEvent.getSource();
		ThemeModel themeModel = (ThemeModel) themeComboBox.getSelectedItem();
		try {
			ConfigurationManager.getInstance().getConfiguration().getUiManager().updateDefaultTheme(themeModel);
		} catch (Exception exception) {
			LibraryLogger.errorMessage(exception.getMessage());
		} 
	}
}
